<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迭代器</title>
</head>
<body>
    <script>
        let arr = [1,2,3,4];

        // 获取数组的指针对象
        let iterator = arr[Symbol.iterator]();
        // console.log(iterator);
        // console.log(arr);

        // console.log(iterator.next());
        // console.log(iterator.next());
        // console.log(iterator.next());
        // console.log(iterator.next());
        // console.log(iterator.next());

        for(let v of arr){
            console.log(v);
        }

    </script>
</body>
</html>